<template>
  <div>
    <button @click="loading">加载</button>
    <hr>
    <button @click="send">发送</button>
    <hr>
    <!--全局组件-->
    <tree />
  </div>
</template>

<script setup lang='ts'>
import { ref, reactive, getCurrentInstance } from 'vue'

const instance = getCurrentInstance()

// 提示加载
const loading = () => {
  instance?.proxy?.$$loading.show()
  setTimeout(() => {
    instance?.proxy?.$$loading.hide()
  }, 3000);
}

// 注册mybus监听
instance?.proxy?.$MyBus.on('mybus-alert', (msg) => {
  alert(msg)
})
const send = () => {
  instance?.proxy?.$MyBus.emit('mybus-alert', '孙小双')
}

</script>

<style lang='scss' scoped>

</style>